<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>

<script type="text/javascript" src="<c:url value="/layout/javascript/largePaginator.js"/>">/**/</script>
<script type="text/javascript" src="<c:url value="/layout/javascript/jquery.form.js"/>">/**/</script> 
<script type="text/javascript" src="<c:url value="/layout/javascript/form.js"/>">/**/</script>
<script type="text/javascript" src="<c:url value="/layout/javascript/form.admin.js"/>">/**/</script>

<script type="text/javascript">
$(document).ready(function() {
	var options = { 
        target:        '#hiddenresult', 
        beforeSubmit:  function () {
                           $('#Searchresult').empty();
                           $('#Searchresult').html('<img alt="<bean:message key="wait.message"/>" src="<c:url value="/layout/images/ajax-loader.gif"/>"/><bean:message key="wait.message"/>');
                       }, 
        success:       function (data) {
				            var identity = data.slice(0,68);
				            // Riceve come risposta il box di errore di validazione
				            if (identity.search('#boxvalidation') != -1) {
				                $('#validationbox').html(data);
				                $('#Searchresult').empty();
				            } else { // Riceve la lista degli utenti
				               $('#hiddenresult').html(data);
				               initPagination(null);
				            }
				       },
        error:         function () {
                           showErrorDialog('#dialog', 
                                   { msg: "<bean:message key="user.history.form.msg" bundle="errors"/>",
                                     boxTitle: "<bean:message key="user.history.form.boxTitle" bundle="errors"/>",
                                     msgStatus: "<bean:message key="user.history.form.msgStatus" bundle="errors"/>" });
                       }  
     };

     $('#form_UH').ajaxForm(options);
    
     $('#form_UH').submit();
});
</script>

<div id="content">
		<fieldset id="fieldset">
			<legend class="fieldsetLabel"><bean:message key="user.history" bundle="profile"/></legend>
				
			<div id="form_containerUH">
				<html:form styleId="form_UH" styleClass="appnitro" action="/admin/userlist.do">
				<div id="divUH">	
					<ul id="ulUH">
					<li id="li_2UH" >
						<label class="description" for="firstandlastname"><bean:message key="user.firstlastname" bundle="profile"/></label>
						<div>
							<html:text styleId="firstandlastname" property="firstandlastname" styleClass="element text large" maxlength="255" /> 
						</div> 
					</li>			
					<li id="li_5UH" >
						<label class="description" for="role"><bean:message key="user.role" bundle="profile"/></label>
						<div>
						    <html:select property="role" styleClass="element select large" styleId="role">
                                <option  selected="selected" value=""><bean:message key="select.option.all"/></option>
                                <html:options collection="role" property="name" labelProperty="description" />
                            </html:select>  
						</div> 
					</li>		
					<li id="buttonsUH">
						<html:submit styleId="searchButton" styleClass="button_text">
						  <bean:message key="button.search"/>
						</html:submit>
					</li>
					</ul>
				</div>	
				</html:form>	
				
				<div id="ListUserHistory">
					<div id="Pagination" class="pagination"> </div>
					<br style="clear:both;" />
					<ul id="label">
                        <li class="UFname"><bean:message key="profile.name.first" bundle="profile"/></li>
                        <li class="UName"><bean:message key="profile.name.last" bundle="profile"/></li>
                        <li class="UNick"><bean:message key="user.username" bundle="profile"/></li>
                        <li class="URole"><bean:message key="user.role" bundle="profile"/></li>
                        <li class="UOffice"><bean:message key="user.office" bundle="profile"/></li>
                        <li class="UEMail"><bean:message key="user.email" bundle="profile"/></li>
                        <li class="UPhone"><bean:message key="profile.phone" bundle="profile"/></li>
                    </ul>
					<div id="Searchresult">
						<img alt="<bean:message key="wait.message"/>" src="<c:url value="/layout/images/ajax-loader.gif"/>"/><bean:message key="wait.message"/>
					</div>
			        
			        <!-- Container element for all the Elements that are to be paginated -->
			        <div id="hiddenresult" style="display:none;">
			        </div>
				</div>
				
			</div>				
		</fieldset>	
</div>